import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { knowledge } from '@/api/apiModulesType';

// 获取日历列表
export function sysScheduleAll(params: any) {
  return request({
    url: `${knowledge}/api/sys/schedule/all`,
    method: 'get',
    params
  });
}

// 获取日历列表(关注)
export function sysScheduleGetPersonalAttention(params?: any) {
  return request({
    url: `${knowledge}/api/sys/schedule/get-personal-attention`,
    method: 'get',
    params
  });
}

// 创建日历
export function createCalendar(data: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sys/schedule/add`,
    method: 'post',
    data
  });
}

// 修改日历
export function sysScheduleEdit(data: any) {
  return request({
    url: `${knowledge}/api/sys/schedule/edit`,
    method: 'put',
    data
  });
}
// 修改时获取日历详情
export function sysScheduleGetDetail(id, page?, size?, userName?, permissionsId?) {
  return request({
    url: `${knowledge}/api/sys/schedule/edit?id=${id}&page=${page}&size=${size}&userName=${userName}&permissionsId=${permissionsId}`,
    method: 'get'
  });
}
// 编辑日历中查询所有权限
export function apiSysScheduleGetPermission(params?: any) {
  return request({
    url: `${knowledge}/api/sys/schedule/get-permissions`,
    method: 'get',
    params
  });
}
// 删除日历
export function sysScheduleDelete(id: any) {
  return request({
    url: `${knowledge}/api/sys/schedule/delete/${id}`,
    method: 'delete'
  });
}
// 关注日历
export function sysScheduleAttentionAdd(data: any) {
  return request({
    url: `${knowledge}/api/sys/schedule/personal-attention-add`,
    method: 'post',
    data
  });
}
// 取消关注日历
export function sysScheduleCancelAttentionDel(scheduleId: any) {
  return request({
    url: `${knowledge}/api/sys/schedule/personal-attention-delete?scheduleId=${scheduleId}`,
    method: 'delete'
  });
}
// 日历成员-添加成员
export function apiSysScheduleUserAdd(data) {
  return request({
    url: `${knowledge}/api/sys/schedule/user-add`,
    method: 'post',
    data
  });
}

// 日历成员-修改成员权限
export function apiSysScheduleUserEdit(data) {
  return request({
    url: `${knowledge}/api/sys/schedule/user-edit`,
    method: 'put',
    data
  });
}

// 日历成员-删除成员
export function apiSysScheduleUserDelete(data) {
  return request({
    url: `${knowledge}/api/sys/schedule/user-delete`,
    method: 'delete',
    data
  });
}

// 查询日程类型
export function apiSysCalendarTypeGetAllSysCalendarTypes(params) {
  return request({
    url: `${knowledge}/api/sysCalendarType/get-all-sys-calendar-types`,
    method: 'get',
    params
  });
}
// 查询资源-无分页
export function apiSysResourceGetAllResource(params?) {
  return request({
    url: `${knowledge}/api/sysResource/get-all-resource`,
    method: 'get',
    params
  });
}
//创建日程
export function apiSysCalendarCreate(data) {
  return request({
    url: `${knowledge}/api/sysCalendar/create`,
    method: "post",
    data
  });
}
// 日程列表
export function sysCalendarQueryInterval(params) {
  return request({
    url: `${knowledge}/api/sysCalendar/queryInterval`,
    method: "get",
    params 
  });
}
// 我的日程修改
export function sysCalendarUpadate(data) {
  return request({
    url: `${knowledge}/api/sysCalendar/update`,
    method: "post",
    data
  });
}

// 获取日程详情显示
export function apiSysCalendarGetDetailShowId(id:any) {
  return request({
    url: `${knowledge}/api/sysCalendar/get-detail-show/${id}`,
    method: "get"
  });
}
// 修改日程的个人状态
export function apiSysCalendarUpdateFeedBack(data) {
  return request({
    url: `${knowledge}/api/sysCalendar/update-feed-back`,
    method: "post",
    data
  });
}
// 删除日程
export function apiSysCalendarDelete(data) {
  return request({
    url: `${knowledge}/api/sysCalendar/delete`,
    method: "post",
    data
  });
}


// 增加成员关注表中成员
export function apiSysScheduleAddAttention(data) {
  return request({
    url: `${knowledge}/api/sys/schedule/add-attention`,
    method: "post",
    data
  });
}
// 查询成员关注表中的成员
export function apiSysScheduleGetAttentionAll(params?) {
  return request({
    url: `${knowledge}/api/sys/schedule/get-attention-all`,
    method: "get",
    params
  });
}
// 查询关注成员的日程数据
export function apiSysScheduleAttentionShow(data) {
  return request({
    url: `${knowledge}/api/sys/schedule/attention-show`,
    method: "post",
    data
  });
}
// 删除成员关注表中的成员
export function apiSysScheduleDeleteAttention(params) {
  return request({
    url: `${knowledge}/api/sys/schedule/delete-attention`,
    method: "delete",
    params
  });
}
// 新增个人关注资源列表
export function apiSysResourceAddResourceFollow(data) {
  return request({
    url: `${knowledge}/api/sysResource/add-resource-follow`,
    method: "post",
    data
  });
}
//个人资源关注列表
export function apiSysResourceGetResourceFollow(params?) {
  return request({
    url: `${knowledge}/api/sysResource/get-resource-follow`,
    method: "get",
    params
  });
}
// 查询关注资源的日程数据
export function apiSysResourceResourceFollowShow(data) {
  return request({
    url: `${knowledge}/api/sysResource/resource-follow-show`,
    method: "post",
    data
  });
}
// 取消关注个人资源列表
export function apiSysResourceDeleteResourceFollow(params) {
  return request({
    url: `${knowledge}/api/sysResource/delete-resource-follow`,
    method: "delete",
    params
  });
}

//根据部门ID获取日历中的人员
export function apiSysResourceGetByDept(params) {
  return request({
    url: `${knowledge}/api/sysResource/get-by-dept`,
    method: "get",
    params
  });
}

export function apiDeptQueryFreePerm(params?) {
  return request({
    url: `system/dept/queryFreePerm`,
    method: 'get',
    params
  });
}


// 语音创建日程
export function voiceAddSchedule(params?) {
  return request({
    url: `aiqa/personal/chat/scheduler/extraction`,
    method: 'get',
    params
  });
}